package com.sync.syncmasterdata;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sync.syncmasterdata.customer.pojo.MayCurPartner;
import com.sync.syncmasterdata.customer.pojo.U8Customer;
import com.sync.syncmasterdata.customer.service.http.HttpAPIServiceForCrmSync;
import com.sync.syncmasterdata.customer.service.impl.SyncServiceImpl;
import com.sync.syncmasterdata.product.controller.ProductController;
import com.sync.syncmasterdata.product.pojo.oa.InventoryForOA;
import com.sync.syncmasterdata.product.service.convert.ProductOAtoWms;
import com.sync.syncmasterdata.vendor.pojo.U8Vendor;
import com.sync.syncmasterdata.vendor.service.SyncVendorServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.ResponseEntity;

@SpringBootTest
@Slf4j
class SyncMasterDataApplicationTestsForRest {

    @Value("${baidu.apikey}")
    private String apiKey;
    @Value("${baidu.secretkey}")
    private String secretKey;

    @Autowired
    private HttpAPIServiceForCrmSync httpAPIServiceForCrmSync;

    @Test
    public void testForRequest() {
        String requestUrl = String.format("https://aip.baidubce.com/oauth/2.0/token?%s&%s&%s", "grant_type=client_credentials", "client_id=" + apiKey, "client_secret=1" + secretKey);
        String ret = httpAPIServiceForCrmSync.doGetOnRest(requestUrl);
        if (StringUtils.isBlank(ret)) {
            System.out.println("无法请求到结果");
        }else{
            System.out.println("请求返回结果:---->"+ret);

        }
    }

}
